package com.feng.leetcode;

import java.util.*;

/**
 * @author feng
 * @decrition
 * @date 2022/11/1322:51
 */
public class L2343 {
    public static int[] smallestTrimmedNumbers(String[] nums, int[][] queries) {
        int[] result = new int[queries.length];
        int length = nums[0].length();
        for (int i = 0; i < queries.length; i++) {
            int len = queries[i][1];
            int index = length - len;
            TreeMap<String, Integer> map = new TreeMap<>();
            for (int j = 0; j < nums.length; j++) {
                String str = nums[j].substring(index);
                char temp = (char) ('a' + j);
                map.put(str + String.valueOf(temp), j);
            }
            String key = (String) map.keySet().toArray()[queries[i][0] - 1];
            Integer integer = map.get(key);
            result[i] = integer;
        }
        return result;
    }

    public static void main(String[] args) {
        String[] nums = {"64333639502","65953866768","17845691654","87148775908","58954177897","70439926174","48059986638","47548857440","18418180516","06364956881","01866627626","36824890579","14672385151","71207752868"};
        int[][] queries = {{13,1},{13,1}};
        smallestTrimmedNumbers(nums, queries);
    }
}
